Skip to content

feat: optional API docs in staging/prod; rename api/manage.py to api/cli.py#520

Merged
somethingnew2-0 merged 2 commits into
mainfrom
pcollins/practical-chebyshev-46a9aa
Jul 15, 2026
Merged

feat: optional API docs in staging/prod; rename api/manage.py to api/cli.py#520
somethingnew2-0 merged 2 commits into
mainfrom
pcollins/practical-chebyshev-46a9aa

Conversation

@somethingnew2-0

Copy link
Copy Markdown
Collaborator

What & why

Two small, independent changes.

Optional OpenAPI docs outside development

Adds an ENABLE_API_DOCS setting (default false) that lets an operator expose the auto-generated OpenAPI docs (/api/docs) and schema (/api/openapi.json) in staging/production. Previously these were mounted only when DEBUG (i.e. ENV=development), so there was no way to reach them in a deployed environment — useful for debugging or client-code generation against a live deployment.

The exposure decision is centralized in a new settings.expose_api_docs property (DEBUG or ENABLE_API_DOCS) that create_app consults for both docs_url and openapi_url. Key safety point: both routes stay behind the app-wide require_authenticated gate, so flipping the flag exposes the docs to authenticated users only — never the public internet. Off by default so deployments don't publish their API surface unless they opt in.

Rename api/manage.pyapi/cli.py

The module is the Click-based CLI (access sync, access notify, …), not a Flask-style management shim, so the old name was misleading. The console-script entry point name (access) is unchanged, so cronjobs/manifests are unaffected. References updated in pyproject.toml (entry point + ty override), the Dockerfile comment, and doc strings.

Notes for reviewers

  • Rebased on latest main, including build: adopt uv and ty in place of pip/tox and mypy #507's uv/ty migration — the rename's config touchpoints landed in pyproject.toml (where the entry point and per-module type-checker override now live) rather than the removed setup.py/.mypy.ini.
  • Verified locally with uv run ty check ., uv run ruff check/format --check, and the full uv run pytest suite (587 passing, including new coverage for the docs toggle and the expose_api_docs policy).

@somethingnew2-0 somethingnew2-0 force-pushed the pcollins/practical-chebyshev-46a9aa branch 2 times, most recently from d138980 to 0ee2cf7 Compare July 14, 2026 23:27
Comment thread POST_MIGRATION_TODO.md

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing these as they're not necessary/low priority/bad ideas

@somethingnew2-0 somethingnew2-0 marked this pull request as ready for review July 15, 2026 23:19
…cli.py

Add an ENABLE_API_DOCS setting (default false) so the auto-generated
OpenAPI docs (/api/docs) and schema (/api/openapi.json) can be exposed
outside development. They remain always-on in development and stay behind
the app-wide require_authenticated gate, so enabling the flag exposes them
to authenticated users only, never the public internet. The policy lives in
a new settings.expose_api_docs property (DEBUG or ENABLE_API_DOCS) that
create_app consults for docs_url/openapi_url.

Also rename api/manage.py to api/cli.py — the module is the Click CLI, not a
Flask-style management shim, so the name was misleading. Updated the console
script entry point and ty override in pyproject.toml, the Dockerfile comment,
and doc references.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@somethingnew2-0 somethingnew2-0 force-pushed the pcollins/practical-chebyshev-46a9aa branch from 0ee2cf7 to 72e5620 Compare July 15, 2026 23:19
Remove "Cache JWKS lookups smarter" (9), "Golden-file response snapshots"
(17), and "Trust proxy X-Forwarded-* only from an allowlist" (21) — not
worth doing. Item 9 was the only entry under the Auth section, so that
heading is dropped too. Remaining item numbers are stable IDs and left
as-is (the list already skips numbers).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@somethingnew2-0 somethingnew2-0 force-pushed the pcollins/practical-chebyshev-46a9aa branch from 72e5620 to b1f772b Compare July 15, 2026 23:20
@somethingnew2-0 somethingnew2-0 requested review from Jeff-Rowell, barborico, eguerrant and matthew-bass and removed request for eguerrant and matthew-bass July 15, 2026 23:21
@somethingnew2-0 somethingnew2-0 enabled auto-merge (squash) July 15, 2026 23:40
@somethingnew2-0 somethingnew2-0 merged commit 65961bf into main Jul 15, 2026
6 checks passed
@somethingnew2-0 somethingnew2-0 deleted the pcollins/practical-chebyshev-46a9aa branch July 15, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants